<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <!-- 测试 清缓存，正式要去掉 -->
    <meta http-equiv="Cache-Control" content="no-cache, no-store, must-revalidate" />
    <meta http-equiv="Pragma" content="no-cache" />
    <meta http-equiv="Expires" content="0" />
    <title>登录</title>
    <link rel="stylesheet" href="/kbs/assets/libs/layui/css/layui.css"/>
    <link rel="stylesheet" href="/kbs/assets/css/login.css?v=312">
    <style>
        .layui-juzhong {
            width: 100%;
            height: 77%;
            font-size: 30px;
            display: -webkit-flex;
            display: flex;
            -webkit-align-items: center;
            align-items: center;
            -webkit-justify-content: center;
            justify-content: center;
        }
    </style>
    <script>
        if (window != top) {
            top.location.replace(location.href);
        }
    </script>
</head>
<body>
<div class="login-wrapper">
    <div class="login-header">
        <img src="/kbs/assets/images/logo.png"><span style="color:#fff;font-weight: normal; font-size: 17px">&nbsp石岩基地平板厂生产实时信息报表登录</span>
    </div>
    <div class="login-body">
        <div class="layui-card">
            <div class="layui-card-header">
                <i class="layui-icon layui-icon-engine"></i>&nbsp;&nbsp;用户登录
            </div>
            <form class="layui-card-body layui-form layui-form-pane">
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-username"></i></label>
                    <div class="layui-input-block">
                        <input name="username" type="text" placeholder="账号" class="layui-input"
                               lay-verType="tips" lay-verify="required" id="username" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <label class="layui-form-label"><i class="layui-icon layui-icon-password"></i></label>
                    <div class="layui-input-block">
                        <input name="password" type="password" placeholder="密码" class="layui-input"
                               lay-verType="tips" lay-verify="required" id="password" required/>
                    </div>
                </div>
                <div class="layui-form-item">
                    <a href="javascript:;" class="layui-link pull-right"
                       onclick="alert('请联系智能制造科管理员修改密码！谢谢！')">忘记密码？</a>
                </div>
                <div class="layui-form-item">
                    <button lay-filter="login-submit" class="layui-btn layui-btn-fluid" lay-submit>登 录</button>
                </div>
            </form>
        </div>
    </div>

    <div class="login-footer">
        <p style="color:#fff">© 2019 深圳创维-RGB电子有限公司 制造总部 智能设备部 智能制造科 版权所有</p>
    </div>
</div>

<div class="login-wrapper-mobile">
    <!--    Logo区域-->
    <div class="layui-row">
        <div class="layui-col-sm12">
            <div class="login-logo">
                <img src="assets/images/wenzi1.png" alt=""
                     style="width: auto;height: auto;max-width: 100%;max-height: 100%;">
            </div>
        </div>
    </div>
    <!--    登录账号密码区域-->
    <div class="layui-row">
        <div class="layui-col-sm12">
            <div style="width: 84%; margin: 0 auto">
                <form class="layui-form" action="" class="login-cont">
                    <!--<ul>
                        <li>123</li>
                        <li>12</li>
                    </ul>-->
                    <div class="layui-row">
                        <div class="layui-col-sm12">
                            <div style="height: 3rem;border-bottom: 1px solid #ebebeb;padding: 1rem">
                                <input type="text" id="username-mobile" name="username-mobile" placeholder="请输入您的账号"
                                       style="border: none;line-height: 4rem; width: 100%; outline: 0;">
                            </div>
                        </div>
                        <div class="layui-col-sm12">
                            <div style="height: 3rem;border-bottom: 1px solid #ebebeb;padding: 1rem">
                                <input type="password" id="password-mobile" name="password-mobile" placeholder="请输入您的密码"
                                       style="border: none;line-height: 4rem; width: 100%; outline: 0;">
                            </div>
                        </div>
                    </div>
                    <div class="layui-row">
                        <div class="layui-col-sm12">
                            <div style="height: 4.4rem;margin-top: 3.7rem">
                                <button class="layui-btn layui-btn-lg layui-btn-primary layui-btn-radius" lay-submit=""
                                        lay-filter="login-mobile"
                                        style="width: 100%;height: 94%;color:#ffffff;background-color: #10A78E;font-size: 1.4rem">
                                    登&nbsp;&nbsp;&nbsp;录
                                </button>
                            </div>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </div>
    <!--    忘记密码-->
    <div class="layui-row">
        <div class="layui-col-sm12">
            <div style="text-align: center;color: #10a78e;line-height: 4rem;font-size: 0.9rem">
                <span onclick="alert('请联系智能制造科管理员！谢谢！')">忘记密码？</span>
            </div>
        </div>
    </div>
</div>

<!-- js部分 -->
<script type="text/javascript" src="/kbs/assets/libs/layui/layui.js"></script>
<script src="/kbs/assets/js/util.js?"+Math.random(); charset="utf-8"></script>
<script type="text/javascript" src="/kbs/assets/js/tools.js?"+Math.random();></script>

<script>
    layui.use(['layer', 'form'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
        var form = layui.form;

        // 监听表单提交
        form.on('submit(login-submit)', function (obj) {
            $.post('http://172.20.212.195:8088/dms/safe_usercenter/safe/user/login?systemId=2&username=' + $("#username").val() + '&password=' + $("#password").val(),
                function (d) {
                    var m = typeof d === "String" ? eval('(' + d + ')') : d;
                    if (m && m.success) {
                        layer.msg('登录成功', {
                            time: 550
                        }, function () {
                            var exp = new Date();
                            exp.setTime(exp.getTime() + 60 * 60 * 24 * 365 * 1000);
                            /*m.functions = {};
                            m.msg = null ; m.user.realName = null;*/
                            var tokenn = m.token;
                            var userId = m.user.id;
                            localStorage.setItem('storageCookie',tokenn );
                            localStorage.setItem('userId',userId );
                            // document.cookie = tokenn + ";expires=" + exp.toGMTString();
                            // document.cookie = "useridentity=" + JSON.stringify(m) + ";expires=" + exp.toGMTString();
                            window.location.href = "/kbs/index.html";
                        })
                    }
                });
            return false;
        });

        form.on('submit(login-mobile)', function (obj) {
            // window.location.href = "/kbs/indexMobile.html";
            $.post('http://172.20.212.195:8088/dms/safe_usercenter/safe/user/login?systemId=2&username=' + $("#username-mobile").val() + '&password=' + $("#password-mobile").val(),
                function (d) {
                    var m = typeof d === "String" ? eval('(' + d + ')') : d;
                    if (m && m.success) {
                        layer.msg('登录成功', {
                            time: 550
                        }, function () {
                            var exp = new Date();
                            exp.setTime(exp.getTime() + 60 * 60 * 24 * 365 * 1000);
                            /*m.functions = {};
                            m.msg = null ; m.user.realName = null;*/
                            // document.cookie = m.token;
                            var tokenn = m.token;
                            var userId = m.user.id;
                            // document.cookie = tokenn + ";expires=" + exp.toGMTString();
                            localStorage.setItem('storageCookie',tokenn );
                            localStorage.setItem('userId',userId );
                            window.location.href = "/kbs/indexMobile.html";
                        })
                    }
                    /*if (m && m.success) {
                        layer.msg('登录成功', {
                            time: 550
                        }, function () {
                            var exp = new Date();
                            exp.setTime(exp.getTime() + 24 * 60 * 60 * 1000 * 365);
                            m.functions = {};
                           // window.m = m;
                            document.cookie = "useridentity=" + m + ";expires=" + exp.toGMTString();
                            if (yvan.checkBrowser()) {
                                window.location.href = "/kbs/index.html";
                            } else {
                                window.location.href = "/kbs/indexMobile.html";
                            }
                        });
                    } else {
                        layer.msg(m.msg, {time: 1500});
                    }*/
                });
            return false;
        });
    });
</script>
</body>
</html>
